#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
vector<int> arr;
vector<int> Index;
int a[10] = {0};
string s;
int main()
{
    cin >> s;
    for (int i = 0; i < 11; i++)
        a[s[i] - '0'] += 1;
    for (int i = 9; i >= 0; i--)
        if (a[i] != 0)
            arr.push_back(i);
    for (int i = 0; i < 11; i++)
        for (int j = 0; j < arr.size(); j++)
            if (s[i] - '0' == arr[j])
                Index.push_back(j);
    cout << "int[] arr = new int[]{" << arr[0];
    for (int i = 1; i < arr.size(); i++)
        cout << ',' << arr[i];
    cout << "};\n" << "int[] Index = new int[]{" << Index[0];
    for (int i = 1; i < Index.size(); i++)
        cout << "," << Index[i];
    cout << "};";
    return 0;
}
//😅